package ihm.panel.camera;

import ihm.applet.KrakenApplet;
import ihm.panel.PanelInterface;
import ihm.tool.AppletConstant;

import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 * Panneau qui affiche les options de stockage des vidéos.
 * @author Guillaume Pocas & Jean-Fraçois Augé
 */
@Deprecated
public class StockagePanel extends JPanel implements ActionListener, PanelInterface {
	
	private static final long serialVersionUID = 1L;
	private KrakenApplet applet;
	
	private JLabel title_jl;
	private JLabel export_jl, keptTime_jl, snapshot_jl;
	private JTextField keptTime_jtf, snapshot_jtf;
	
	private JButton export_jb, save_jb, cancel_jb;
	
	/**
	 * Constructeur.
	 * @param applet
	 */
	public StockagePanel(KrakenApplet applet) {
		this.applet = applet;
		initPanel();
	}
	
	@Override
	public void initPanel() {
		this.setLayout(new GridBagLayout());
		
		GridBagConstraints c = new GridBagConstraints();
		c.insets = new Insets(AppletConstant.BUTTON_INSET,
				AppletConstant.BUTTON_INSET,
				AppletConstant.BUTTON_INSET,
				AppletConstant.BUTTON_INSET);
		
		title_jl = new JLabel("<html><u>Configuration du serveur de site</u></html>");
		title_jl.setFont(new Font("Tahoma", Font.PLAIN, 30));
		
		export_jl = new JLabel("Exporter :");
		keptTime_jl = new JLabel("Temps de stockage des snapshots :");
		snapshot_jl = new JLabel("Temps de stockage des vidéos :");
		
		export_jb = new JButton("Exporter");
		export_jb.setPreferredSize(AppletConstant.BUTTON_SIZE);
		
		keptTime_jtf = new JTextField();
		keptTime_jtf.setPreferredSize(AppletConstant.FIELD_SIZE);
		
		snapshot_jtf = new JTextField();
		snapshot_jtf.setPreferredSize(AppletConstant.FIELD_SIZE);
		
		save_jb = new JButton("Sauvegarder");
		save_jb.setPreferredSize(AppletConstant.BUTTON_SIZE);
		save_jb.addActionListener(this);
		
		cancel_jb = new JButton("Annuler");
		cancel_jb.setPreferredSize(AppletConstant.BUTTON_SIZE);
		cancel_jb.addActionListener(this);
		
		c.gridx = 0;								// position en x
		c.gridy = 0;								// position en y
		c.gridwidth = GridBagConstraints.REMAINDER;	// largeur de l'object en nombre de case, ici le reste de la ligne
		c.anchor = GridBagConstraints.WEST;			// l'ancrage de l'object
		c.fill = GridBagConstraints.NONE;			// est ce que l'object prend toute la case?
		add(title_jl, c);
		
		c.gridx = 0;
		c.gridy = 1;
		c.gridwidth = 1;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.NONE;
		add(export_jl, c);
		
		c.gridx = 1;
		c.gridy = 1;
		c.gridwidth = 1;
		c.anchor = GridBagConstraints.EAST;
		c.fill = GridBagConstraints.HORIZONTAL;
		add(export_jb, c);
		
		c.gridx = 0;
		c.gridy = 2;
		c.gridwidth = 1;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.NONE;
		add(keptTime_jl, c);
		
		c.gridx = 1;
		c.gridy = 2;
		c.gridwidth = 1;
		c.anchor = GridBagConstraints.EAST;
		c.fill = GridBagConstraints.HORIZONTAL;
		add(keptTime_jtf, c);
		
		c.gridx = 0;
		c.gridy = 3;
		c.gridwidth = 1;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.NONE;
		add(snapshot_jl, c);
		
		c.gridx = 1;
		c.gridy = 3;
		c.gridwidth = 1;
		c.anchor = GridBagConstraints.EAST;
		c.fill = GridBagConstraints.HORIZONTAL;
		add(snapshot_jtf, c);
		
		c.gridx = 0;
		c.gridy = 4;
		c.gridwidth = 1;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.NONE;
		add(save_jb, c);
		
		c.gridx = 1;
		c.gridy = 4;
		c.gridwidth = GridBagConstraints.REMAINDER;
		c.anchor = GridBagConstraints.EAST;
		c.fill = GridBagConstraints.HORIZONTAL;
		add(cancel_jb, c);
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource().equals(save_jb)) {
		}
	}
	
}
